"use strict"; // 使用严格模式

import axios from "axios";

export default {
  namespaced: true,
  state: {
    todolist: []
  },
  getters: {},
  mutations: {
    SET_TODOLIST(state, data) {
      state.todolist = data;
    }
  },
  actions: {
    getTodoListData({ commit }) {
      axios({
        url: "https://api.yizhanketang.cn/api/v1/todos"
      }).then(res => {
        // console.log(res.data.data)
        commit("SET_TODOLIST", res.data.data);
      });
    }
  }
};
